<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/common.jspf"%>
<%@ include file="/common/taglibs.jspf"%>
<html lang="en">
<head>
<!-- jquery datatables -->
<link href="${contextPath}/widgets/jquery-datatables/css/jquery.dataTables.css" rel="stylesheet" />
<script src="${contextPath }/widgets/jquery-datatables/js/jquery.dataTables.min.js"></script>
<script src="${contextPath }/widgets/jquery-datatables/js/jquery.dataTables.bootstrap.js"></script>
</head>
<body>
	<!-- quick view -->
	<div class="quickview">
		<ul>
			<li><span class="brand"><i class="icon-tags"></i></span></li>
			<li <c:if test="${empty param.quickView }">class="active"</c:if>>
				<a href="#"><s:message code="quickView.all" /></a>
			</li>
		</ul>
		<div class="clear"></div>
	</div>
	<!-- toolbar -->
	<div class="toolbar">
		<div class="pull-left">
			<button class="btn btn-small btn-primary" onclick="javascript:location.href='renewOrder.do?tenantId=${tenantId }'">
				<i class="icon-plus icon-white"></i>
				<s:message code="tenantOrder.func.renew" />
			</button>
			<button class="btn btn-small btn-danger" onclick="javascript:return batchDelete();">
				<i class="icon-trash icon-white"></i>
				<s:message code="btn.delete" />
			</button>
		</div>
		<div class="clear"></div>
	</div>
	<!-- datatable -->
	<div>
		<table
			class="table table-striped table-bordered table-hover datatable">
			<thead>
				<tr>
					<th class="checkCol"><s:message code="common.field.index" /></th>
					<th><s:message code="tenantOrder.orderNo" /></th>
					<th><s:message code="tenantOrder.orderType" /></th>
					<th><s:message code="tenantOrder.bagCode" /></th>
					<th><s:message code="tenantOrder.price" /></th>
					<th><s:message code="tenantOrder.quantity" /></th>
					<th><s:message code="tenantOrder.status" /></th>
					<th><s:message code="common.field.createBy" /></th>
					<th><s:message code="common.field.createDatetime" /></th>
					<th><s:message code="common.action" /></th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${pageList.rsList }" var="row" varStatus="status">
					<tr>
						<td class="checkCol"><c:out value="${status.index+1 }"></c:out></td>
						<td><c:out value="${row.TenantOrder.orderNo }"></c:out></td>
						<td><c:out value="${li:genDictContent('tenantOrder-type', row.TenantOrder.orderType) }"></c:out></td>
						<td><c:out value="${row.TenantOrder.productNo }"></c:out></td>
						<td><c:out value="${row.TenantOrder.price }"></c:out></td>
						<td><c:out value="${row.TenantOrder.quantity }"></c:out></td>
						<td><c:out value="${li:genDictContent('tenantOrder-status', row.TenantOrder.status) }"></c:out></td>
						<td><c:out value="${row.UserInfo.userName }"></c:out></td>
						<td><c:out value="${row.TenantOrder.createDatetime }"></c:out></td>
						<td>
							<div class="action-buttons">
								<a href="showOrder.do?id=${row.TenantOrder.id }" class="blue"><i class="icon-pencil"></i></a>&nbsp;
							</div>
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
		<h:pager params="${pageList }" formId="datatable"></h:pager>
	</div>
	<div class="form-actions" style="text-align: center;">
		<button type="button" class="btn" onclick="history.back();">
			<s:message code="btn.back" />
		</button>
	</div>
	<script type="text/javascript">
		$(document).ready(function(){				
			$('.datatable').dataTable();	
			var checkboxs = $.webtools.checkboxs({
				checkAll: "#checkAll",
				checkItem: ".checkItem"				
			});
		});
		
		
		function batchDelete(){					
			if($(".checkItem:checked").length<=0) {
				$.webtools.notify({
					type: "notice",
					message: "<s:message code='validate.checkone'/>"
				});
				return;
			}
			var ids = $.webtools.getCheckValuesArray(".checkItem");	
		
			bootbox.confirm("<s:message code='common.delete.confirm' />", function(result){
				if(result){
					$.webtools.ajax({
						url: "deleteBatch.json",
						params: {"ids":ids},
						success: function(reply) {
							location.reload();
						}
					});						
				}				
			});			
		}	
				
		function rowDelete(id){			
			bootbox.confirm("<s:message code='common.delete.confirm' />", function(result){
				if(result)
				{
					$.webtools.ajax({
						url: "delete.json",
						params: {"id":id},
						success: function(reply) {
							location.reload();
						}
					});					
				}				
			});			
		}		
	</script>
</body>
</html>
